package com.bjshiwei.zhengu.ui.fragment;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.bjshiwei.zhengu.utils.LogUtils;

/**
 * 作者：Administrator on 2017/2/9 0009 18:35
 * 邮箱：sanjins@126.com
 */


public abstract class BaseFragment extends Fragment{


    @Override
    public void onAttach(Context context) {
        LogUtils.LogI("====on Attach====");
        super.onAttach(context);
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        LogUtils.LogI("====on Create====");
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        LogUtils.LogI("====on CreateView====");
        View view = initView(inflater);
        initFindViewById(view);
        initData();
        setData();
        setListener();
        return view;
//        return super.onCreateView(inflater, container, savedInstanceState);
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        LogUtils.LogI("====on ActivityCreated====");
        super.onActivityCreated(savedInstanceState);
    }

    @Override
    public void onStart() {
        LogUtils.LogI("====on Start====");
        super.onStart();
    }

    @Override
    public void onResume() {
        LogUtils.LogI("====on Resume====");
        super.onResume();
    }

    @Override
    public void onPause() {
        LogUtils.LogI("====on Pause====");
        super.onPause();
    }

    @Override
    public void onStop() {
        LogUtils.LogI("====on Stop====");
        super.onStop();
    }

    @Override
    public void onDestroyView() {
        LogUtils.LogI("====on DestroyView====");
        super.onDestroyView();
    }

    @Override
    public void onDestroy() {
        LogUtils.LogI("====on Destroy====");
        super.onDestroy();
    }

    @Override
    public void onDetach() {
        LogUtils.LogI("====on Detach====");
        super.onDetach();
    }


    protected abstract void setListener();

    protected abstract void setData();

    protected abstract void initData();

    //初始化界面
    protected abstract View initView(LayoutInflater inflater);
    protected abstract void initFindViewById(View view);
}
